﻿using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using JT.WEB.Controllers;
using Microsoft.AspNetCore.Mvc;

namespace JT.WEB.Models.Were
{
    public partial class TbWuPinInfo
    {
        public TbWuPinInfo()
        {
            TbChuRuInfo = new HashSet<TbChuRuInfo>();
        }
        [Key]
        [Display(Name = "物品ID")]
        public int NameId { get; set; }
        //[Key]
        [Display(Name = "物品名字")]
        [Remote(nameof(WereHouseController.MyExists), "WereHouse", AdditionalFields = nameof(NameId) + "," + nameof(ItemName))]
        [Required(ErrorMessage = "不能为空！")]
        [MaxLength(20, ErrorMessage = "名字超出长度！")]
        public string ItemName { get; set; }



        [Display(Name = "类名")]
        [Required(ErrorMessage = "不能为空！")]
        [MaxLength(20, ErrorMessage = "名字超出长度！")]
        public int NameClassId { get; set; }

        [Display(Name = "规格")]
        [Required(ErrorMessage = "不能为空！")]
        [MaxLength(20, ErrorMessage = "名字超出长度！")]
        public string CStandard { get; set; }

        [Display(Name = "库存")]
        public double? Inventory { get; set; }

        [Display(Name = "单位")]
        [Required(ErrorMessage = "不能为空！")]
        [MaxLength(10, ErrorMessage = "名字超出长度！")]
        public string UnitName { get; set; }

        [Display(Name = "价格")]
        public double? UnitPrice { get; set; }

        //[Display(Name = "入库人")]
        //[MaxLength(10, ErrorMessage = "名字超出长度！")]
        //public string NamePerson { get; set; }



        //[ForeignKey(nameof(NamePerson))]
        //public virtual TbNamePerson NamePersonNavigation { get; set; }
        [ForeignKey(nameof(NameClassId))]
        [DisplayName("物品")]
        public virtual TbNameClass NameClassNavigation { get; set; }
        public string Recorder { get; set; }

        public ICollection<TbChuRuInfo> TbChuRuInfo { get; set; }
    }
}